package com.atguigu.edu.realtime.dwd.log.app;

import com.atguigu.edu.realtime.common.base.BaseSQLApp;
import com.atguigu.edu.realtime.common.util.SQLUtil;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

public class DWDInteractionVideoSQL extends BaseSQLApp {
    public static void main(String[] args) {
        new DWDInteractionVideoSQL().start(10013,4,"userwatch");
    }
    @Override
    public void handle1(StreamExecutionEnvironment env, StreamTableEnvironment tableEnv) {
        tableEnv.executeSql("CREATE TABLE topic (\n" +
                "  `common` map<string,string>,\n" +
                "  `appVideo` map<string,string>,\n" +
              //  "  `err` map<string,string>,\n" +
                "  ts bigint,\n" +
                "  pt as proctime(),\n" +
                "  et as TO_TIMESTAMP_LTZ(ts, 0),\n" +
                "  watermark for et as et\n" +
                ") "+ SQLUtil.getKafkaDDL("appVideo","userr"));
        tableEnv.executeSql("select * from topic").print();
    }
}
